home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume9 / uemacs3.8b / part01 next >
Encoding:
Internet Message Format  |  1987-05-04  |  55.7 KB

  1. Subject:  v09i033:  MicroEMACS, version 3.8b, Part01/14
  2. Approved: rs@mirror.TMC.COM
  3. Path: mirror!sources-request
  4. From: sources-request@mirror.TMC.COM
  5. Newsgroups: comp.sources.unix
  6. Message-ID: <2284@mirror.TMC.COM>
  7. Sender: rs@mirror.TMC.COM
  8. Approved: rs@mirror.TMC.COM
  9. Lines: 2497
  10.  
  11. Submitted by: ihnp4!itivax!duncan!lawrence (Daniel Lawrence)
  12. Mod.sources: Volume 9, Issue 33
  13. Archive-name: uemacs3.8b/Part01
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line,
  17. # then unpack it by saving it in a file and typing "sh file".
  18. # If this archive is complete, you will see the message:
  19. #        "End of archive 1 (of 14)."
  20. # Contents:  MANIFEST Makefile ansi.c azmap.cmd bdata.cmd dg10.c
  21. #   emacs.rc epath.h esearch.h evar.h fileio.c hp110.c ibmfn.lst
  22. #   lock.c magic.doc me110.rc me150.rc tcap.c vt52.c
  23. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  24. echo shar: Extracting \"MANIFEST\" \(1764 characters\)
  25. if test -f MANIFEST ; then 
  26.   echo shar: Will not over-write existing file \"MANIFEST\"
  27. else
  28. sed "s/^X//" >MANIFEST <<'END_OF_MANIFEST'
  29. X   File Name        Archive #    Description
  30. X-----------------------------------------------------------
  31. X MANIFEST                  1    This shipping list
  32. X Makefile                  1    
  33. X ansi.c                    1    
  34. X azmap.cmd                 1    
  35. X basic.c                   5    
  36. X bdata.cmd                 1    
  37. X bind.c                    6    
  38. X buffer.c                  6    
  39. X crypt.c                   2    
  40. X dg10.c                    1    
  41. X display.c                11    
  42. X ebind.h                   4    
  43. X edef.h                    3    
  44. X efunc.h                   5    
  45. X egapc.c                   2    
  46. X emacs.hlp                 3    
  47. X emacs.key                 2    
  48. X emacs.rc                  1    
  49. X emacs.tut                11    
  50. X emacs1.mss               14    
  51. X epath.h                   1    
  52. X esearch.h                 1    
  53. X estruct.h                 8    
  54. X eval.c                    4    
  55. X evar.h                    1    
  56. X exec.c                    7    
  57. X file.c                    9    
  58. X fileio.c                  1    
  59. X hp110.c                   1    
  60. X hp150.c                   3    
  61. X ibmfn.lst                 1    
  62. X ibmpc.c                   2    
  63. X input.c                   3    
  64. X isearch.c                 9    
  65. X line.c                   10    
  66. X lock.c                    1    
  67. X magic.doc                 1    
  68. X main.c                   13    
  69. X me110.rc                  1    
  70. X me150.rc                  1    
  71. X menu.cmd                  4    
  72. X menu1                     3    
  73. X random.c                 10    
  74. X readme                    8    
  75. X region.c                  2    
  76. X search.c                 12    
  77. X spawn.c                   7    
  78. X st520.c                   4    
  79. X tcap.c                    1    
  80. X termio.c                  5    
  81. X tipc.c                    2    
  82. X vmsvt.c                   2    
  83. X vt52.c                    1    
  84. X window.c                  7    
  85. X word.c                    6    
  86. END_OF_MANIFEST
  87. if test 1764 -ne `wc -c <MANIFEST`; then
  88.     echo shar: \"MANIFEST\" unpacked with wrong size!
  89. fi
  90. # end of overwriting check
  91. fi
  92. echo shar: Extracting \"Makefile\" \(585 characters\)
  93. if test -f Makefile ; then 
  94.   echo shar: Will not over-write existing file \"Makefile\"
  95. else
  96. sed "s/^X//" >Makefile <<'END_OF_Makefile'
  97. XCFLAGS=        -O
  98. X
  99. XOFILES=        ansi.o basic.o bind.o buffer.o display.o file.o \
  100. X        fileio.o hp150.o line.o lock.c main.o random.o region.o \
  101. X        search.o spawn.o tcap.o termio.o vt52.o window.o word.o \
  102. X        exec.o eval.o isearch.o
  103. X
  104. XCFILES=        ansi.c basic.c bind.c buffer.c display.c  file.c \
  105. X        fileio.c hp150.c line.c lock.c main.c random.c region.c \
  106. X        search.c spawn.c tcap.c termio.c vt52.c window.c word.c \
  107. X        exec.c eval.c isearch.c
  108. X
  109. XHFILES=        estruct.h edef.h efunc.h epath.h ebind.h evar.h esearch.h
  110. X
  111. Xemacs:        $(OFILES)
  112. X        $(CC) $(CFLAGS) $(OFILES) -ltermcap -lc -o emacs
  113. X
  114. X$(OFILES):    $(HFILES)
  115. END_OF_Makefile
  116. if test 585 -ne `wc -c <Makefile`; then
  117.     echo shar: \"Makefile\" unpacked with wrong size!
  118. fi
  119. # end of overwriting check
  120. fi
  121. echo shar: Extracting \"ansi.c\" \(4419 characters\)
  122. if test -f ansi.c ; then 
  123.   echo shar: Will not over-write existing file \"ansi.c\"
  124. else
  125. sed "s/^X//" >ansi.c <<'END_OF_ansi.c'
  126. X/*
  127. X * The routines in this file provide support for ANSI style terminals
  128. X * over a serial line. The serial I/O services are provided by routines in
  129. X * "termio.c". It compiles into nothing if not an ANSI device.
  130. X */
  131. X
  132. X#define    termdef    1            /* don't define "term" external */
  133. X
  134. X#include        <stdio.h>
  135. X#include    "estruct.h"
  136. X#include        "edef.h"
  137. X
  138. X#if     ANSI
  139. X
  140. X#if    AMIGA
  141. X#define NROW    23                      /* Screen size.                 */
  142. X#define NCOL    77                      /* Edit if you want to.         */
  143. X#else
  144. X#define NROW    25                      /* Screen size.                 */
  145. X#define NCOL    80                      /* Edit if you want to.         */
  146. X#endif
  147. X#define    NPAUSE    100            /* # times thru update to pause */
  148. X#define    MARGIN    8            /* size of minimim margin and    */
  149. X#define    SCRSIZ    64            /* scroll size for extended lines */
  150. X#define BEL     0x07                    /* BEL character.               */
  151. X#define ESC     0x1B                    /* ESC character.               */
  152. X
  153. Xextern  int     ttopen();               /* Forward references.          */
  154. Xextern  int     ttgetc();
  155. Xextern  int     ttputc();
  156. Xextern  int     ttflush();
  157. Xextern  int     ttclose();
  158. Xextern  int     ansimove();
  159. Xextern  int     ansieeol();
  160. Xextern  int     ansieeop();
  161. Xextern  int     ansibeep();
  162. Xextern  int     ansiopen();
  163. Xextern    int    ansirev();
  164. Xextern    int    ansiclose();
  165. Xextern    int    ansikopen();
  166. Xextern    int    ansikclose();
  167. Xextern    int    ansicres();
  168. X
  169. X#if    COLOR
  170. Xextern    int    ansifcol();
  171. Xextern    int    ansibcol();
  172. X
  173. Xint    cfcolor = -1;        /* current forground color */
  174. Xint    cbcolor = -1;        /* current background color */
  175. X#endif
  176. X
  177. X/*
  178. X * Standard terminal interface dispatch table. Most of the fields point into
  179. X * "termio" code.
  180. X */
  181. XTERM    term    = {
  182. X    NROW-1,
  183. X        NROW-1,
  184. X        NCOL,
  185. X        NCOL,
  186. X    MARGIN,
  187. X    SCRSIZ,
  188. X    NPAUSE,
  189. X        ansiopen,
  190. X        ansiclose,
  191. X    ansikopen,
  192. X    ansikclose,
  193. X        ttgetc,
  194. X        ttputc,
  195. X        ttflush,
  196. X        ansimove,
  197. X        ansieeol,
  198. X        ansieeop,
  199. X        ansibeep,
  200. X    ansirev,
  201. X    ansicres
  202. X#if    COLOR
  203. X    , ansifcol,
  204. X    ansibcol
  205. X#endif
  206. X};
  207. X
  208. X#if    COLOR
  209. Xansifcol(color)        /* set the current output color */
  210. X
  211. Xint color;    /* color to set */
  212. X
  213. X{
  214. X    if (color == cfcolor)
  215. X        return;
  216. X    ttputc(ESC);
  217. X    ttputc('[');
  218. X    ansiparm(color+30);
  219. X    ttputc('m');
  220. X    cfcolor = color;
  221. X}
  222. X
  223. Xansibcol(color)        /* set the current background color */
  224. X
  225. Xint color;    /* color to set */
  226. X
  227. X{
  228. X    if (color == cbcolor)
  229. X        return;
  230. X    ttputc(ESC);
  231. X    ttputc('[');
  232. X    ansiparm(color+40);
  233. X    ttputc('m');
  234. X        cbcolor = color;
  235. X}
  236. X#endif
  237. X
  238. Xansimove(row, col)
  239. X{
  240. X        ttputc(ESC);
  241. X        ttputc('[');
  242. X        ansiparm(row+1);
  243. X        ttputc(';');
  244. X        ansiparm(col+1);
  245. X        ttputc('H');
  246. X}
  247. X
  248. Xansieeol()
  249. X{
  250. X        ttputc(ESC);
  251. X        ttputc('[');
  252. X        ttputc('K');
  253. X}
  254. X
  255. Xansieeop()
  256. X{
  257. X#if    COLOR
  258. X    ansifcol(gfcolor);
  259. X    ansibcol(gbcolor);
  260. X#endif
  261. X        ttputc(ESC);
  262. X        ttputc('[');
  263. X        ttputc('J');
  264. X}
  265. X
  266. Xansirev(state)        /* change reverse video state */
  267. X
  268. Xint state;    /* TRUE = reverse, FALSE = normal */
  269. X
  270. X{
  271. X#if    COLOR
  272. X    int ftmp, btmp;        /* temporaries for colors */
  273. X#endif
  274. X
  275. X    ttputc(ESC);
  276. X    ttputc('[');
  277. X    ttputc(state ? '7': '0');
  278. X    ttputc('m');
  279. X#if    COLOR
  280. X    if (state == FALSE) {
  281. X        ftmp = cfcolor;
  282. X        btmp = cbcolor;
  283. X        cfcolor = -1;
  284. X        cbcolor = -1;
  285. X        ansifcol(ftmp);
  286. X        ansibcol(btmp);
  287. X    }
  288. X#endif
  289. X}
  290. X
  291. Xansicres()    /* change screen resolution */
  292. X
  293. X{
  294. X    return(TRUE);
  295. X}
  296. X
  297. Xansibeep()
  298. X{
  299. X        ttputc(BEL);
  300. X        ttflush();
  301. X}
  302. X
  303. Xansiparm(n)
  304. Xregister int    n;
  305. X{
  306. X        register int q,r;
  307. X
  308. X        q = n/10;
  309. X        if (q != 0) {
  310. X        r = q/10;
  311. X        if (r != 0) {
  312. X            ttputc((r%10)+'0');
  313. X        }
  314. X        ttputc((q%10) + '0');
  315. X        }
  316. X        ttputc((n%10) + '0');
  317. X}
  318. X
  319. Xansiopen()
  320. X{
  321. X#if     V7 | USG | BSD
  322. X        register char *cp;
  323. X        char *getenv();
  324. X
  325. X        if ((cp = getenv("TERM")) == NULL) {
  326. X                puts("Shell variable TERM not defined!");
  327. X                exit(1);
  328. X        }
  329. X        if (strcmp(cp, "vt100") != 0) {
  330. X                puts("Terminal type not 'vt100'!");
  331. X                exit(1);
  332. X        }
  333. X#endif
  334. X    strcpy(sres, "NORMAL");
  335. X    revexist = TRUE;
  336. X        ttopen();
  337. X}
  338. X
  339. Xansiclose()
  340. X
  341. X{
  342. X#if    COLOR
  343. X    ansifcol(7);
  344. X    ansibcol(0);
  345. X#endif
  346. X    ttclose();
  347. X}
  348. X
  349. Xansikopen()    /* open the keyboard (a noop here) */
  350. X
  351. X{
  352. X}
  353. X
  354. Xansikclose()    /* close the keyboard (a noop here) */
  355. X
  356. X{
  357. X}
  358. X
  359. X#if    FLABEL
  360. Xfnclabel(f, n)        /* label a function key */
  361. X
  362. Xint f,n;    /* default flag, numeric argument [unused] */
  363. X
  364. X{
  365. X    /* on machines with no function keys...don't bother */
  366. X    return(TRUE);
  367. X}
  368. X#endif
  369. X#else
  370. Xansihello()
  371. X{
  372. X}
  373. X#endif
  374. END_OF_ansi.c
  375. if test 4419 -ne `wc -c <ansi.c`; then
  376.     echo shar: \"ansi.c\" unpacked with wrong size!
  377. fi
  378. # end of overwriting check
  379. fi
  380. echo shar: Extracting \"azmap.cmd\" \(521 characters\)
  381. if test -f azmap.cmd ; then 
  382.   echo shar: Will not over-write existing file \"azmap.cmd\"
  383. else
  384. sed "s/^X//" >azmap.cmd <<'END_OF_azmap.cmd'
  385. X;    AZMAP.CMD:    MicroEMACS Macro file
  386. X;            to translate an AZTEC C .SYM map file into
  387. X;            the form needed to read it into ADDSYMS
  388. X;            to be used with Pheonix's PFIX plus (C) debugger
  389. X;
  390. X;            written 6/5/86 by Daniel Lawrence
  391. X
  392. Xbeginning-of-file
  393. Xnewline
  394. Xprevious-line
  395. Xreplace-string "~n" "~n 0000:"
  396. Xbeginning-of-line
  397. Xkill-to-end-of-line
  398. Xnewline
  399. Xnewline
  400. Xnewline
  401. Xbeginning-of-file
  402. Xnewline
  403. Xinsert-string "  Address         Publics by Name"
  404. Xnewline
  405. Xset-mark
  406. Xend-of-file
  407. Xcase-region-upper
  408. Xbeginning-of-file
  409. Xreplace-string "_~n" "~n"
  410. X
  411. END_OF_azmap.cmd
  412. if test 521 -ne `wc -c <azmap.cmd`; then
  413.     echo shar: \"azmap.cmd\" unpacked with wrong size!
  414. fi
  415. # end of overwriting check
  416. fi
  417. echo shar: Extracting \"bdata.cmd\" \(502 characters\)
  418. if test -f bdata.cmd ; then 
  419.   echo shar: Will not over-write existing file \"bdata.cmd\"
  420. else
  421. sed "s/^X//" >bdata.cmd <<'END_OF_bdata.cmd'
  422. X;Create a block of DATA statements for a BASIC program
  423. X; within MicroEMACS 3.8
  424. X
  425. X    insert-string "1000 DATA "
  426. X    set %linenum 1000
  427. X
  428. X*nxtin
  429. X    update-screen        ;make sure we see the changes
  430. X    set %data @"Next number[0 to end]: "
  431. X    !if &equal %data 0
  432. X        !goto finish
  433. X    !endif
  434. X
  435. X    !if &greater $curcol 60
  436. X        2 delete-previous-character
  437. X        newline
  438. X        set %linenum &add %linenum 10
  439. X        insert-string &cat %linenum " DATA "
  440. X    !endif
  441. X
  442. X    insert-string &cat %data ", "
  443. X    !goto nxtin
  444. X
  445. X*finish
  446. X
  447. X    2 delete-previous-character
  448. X    newline
  449. X
  450. X
  451. END_OF_bdata.cmd
  452. if test 502 -ne `wc -c <bdata.cmd`; then
  453.     echo shar: \"bdata.cmd\" unpacked with wrong size!
  454. fi
  455. # end of overwriting check
  456. fi
  457. echo shar: Extracting \"dg10.c\" \(3266 characters\)
  458. if test -f dg10.c ; then 
  459.   echo shar: Will not over-write existing file \"dg10.c\"
  460. else
  461. sed "s/^X//" >dg10.c <<'END_OF_dg10.c'
  462. X/*
  463. X * The routines in this file provide support for the Data General Model 10
  464. X * Microcomputer.
  465. X */
  466. X
  467. X#define    termdef    1            /* don't define "term" external */
  468. X
  469. X#include        <stdio.h>
  470. X#include    "estruct.h"
  471. X#include        "edef.h"
  472. X
  473. X#if     DG10
  474. X
  475. X#define NROW    24                      /* Screen size.                 */
  476. X#define NCOL    80                      /* Edit if you want to.         */
  477. X#define    NPAUSE    100            /* # times thru update to pause */
  478. X#define    MARGIN    8            /* size of minimim margin and    */
  479. X#define    SCRSIZ    64            /* scroll size for extended lines */
  480. X#define BEL     0x07                    /* BEL character.               */
  481. X#define ESC     30                      /* DG10 ESC character.          */
  482. X
  483. Xextern  int     ttopen();               /* Forward references.          */
  484. Xextern  int     ttgetc();
  485. Xextern  int     ttputc();
  486. Xextern  int     ttflush();
  487. Xextern  int     ttclose();
  488. Xextern    int    dg10kopen();
  489. Xextern    int    dg10kclose();
  490. Xextern  int     dg10move();
  491. Xextern  int     dg10eeol();
  492. Xextern  int     dg10eeop();
  493. Xextern  int     dg10beep();
  494. Xextern  int     dg10open();
  495. Xextern    int    dg10rev();
  496. Xextern    int    dg10close();
  497. Xextern    int    dg10cres();
  498. X
  499. X#if    COLOR
  500. Xextern    int    dg10fcol();
  501. Xextern    int    dg10bcol();
  502. X
  503. Xint    cfcolor = -1;        /* current forground color */
  504. Xint    cbcolor = -1;        /* current background color */
  505. Xint    ctrans[] = {        /* emacs -> DG10 color translation table */
  506. X    0, 4, 2, 6, 1, 5, 3, 7};
  507. X#endif
  508. X
  509. X/*
  510. X * Standard terminal interface dispatch table. Most of the fields point into
  511. X * "termio" code.
  512. X */
  513. XTERM    term    = {
  514. X    NROW-1,
  515. X        NROW-1,
  516. X        NCOL,
  517. X        NCOL,
  518. X    MARGIN,
  519. X    SCRSIZ,
  520. X    NPAUSE,
  521. X        dg10open,
  522. X        dg10close,
  523. X    dg10kopen,
  524. X    dg10kclose,
  525. X        ttgetc,
  526. X        ttputc,
  527. X        ttflush,
  528. X        dg10move,
  529. X        dg10eeol,
  530. X        dg10eeop,
  531. X        dg10beep,
  532. X    dg10rev,
  533. X    dg10cres
  534. X#if    COLOR
  535. X    , dg10fcol,
  536. X    dg10bcol
  537. X#endif
  538. X};
  539. X
  540. X#if    COLOR
  541. Xdg10fcol(color)        /* set the current output color */
  542. X
  543. Xint color;    /* color to set */
  544. X
  545. X{
  546. X    if (color == cfcolor)
  547. X        return;
  548. X    ttputc(ESC);
  549. X    ttputc(0101);
  550. X    ttputc(ctrans[color]);
  551. X    cfcolor = color;
  552. X}
  553. X
  554. Xdg10bcol(color)        /* set the current background color */
  555. X
  556. Xint color;    /* color to set */
  557. X
  558. X{
  559. X    if (color == cbcolor)
  560. X        return;
  561. X    ttputc(ESC);
  562. X    ttputc(0102);
  563. X    ttputc(ctrans[color]);
  564. X        cbcolor = color;
  565. X}
  566. X#endif
  567. X
  568. Xdg10move(row, col)
  569. X{
  570. X    ttputc(16);
  571. X        ttputc(col);
  572. X    ttputc(row);
  573. X}
  574. X
  575. Xdg10eeol()
  576. X{
  577. X        ttputc(11);
  578. X}
  579. X
  580. Xdg10eeop()
  581. X{
  582. X#if    COLOR
  583. X    dg10fcol(gfcolor);
  584. X    dg10bcol(gbcolor);
  585. X#endif
  586. X        ttputc(ESC);
  587. X        ttputc(0106);
  588. X        ttputc(0106);
  589. X}
  590. X
  591. Xdg10rev(state)        /* change reverse video state */
  592. X
  593. Xint state;    /* TRUE = reverse, FALSE = normal */
  594. X
  595. X{
  596. X#if    COLOR
  597. X    if (state == TRUE) {
  598. X        dg10fcol(0);
  599. X        dg10bcol(7);
  600. X    }
  601. X#else
  602. X    ttputc(ESC);
  603. X    ttputc(state ? 0104: 0105);
  604. X#endif
  605. X}
  606. X
  607. Xdg10cres()    /* change screen resolution */
  608. X
  609. X{
  610. X    return(TRUE);
  611. X}
  612. X
  613. Xdg10beep()
  614. X{
  615. X        ttputc(BEL);
  616. X        ttflush();
  617. X}
  618. X
  619. Xdg10open()
  620. X{
  621. X    strcpy(sres, "NORMAL");
  622. X    revexist = TRUE;
  623. X        ttopen();
  624. X}
  625. X
  626. Xdg10close()
  627. X
  628. X{
  629. X#if    COLOR
  630. X    dg10fcol(7);
  631. X    dg10bcol(0);
  632. X#endif
  633. X    ttclose();
  634. X}
  635. X
  636. Xdg10kopen()
  637. X
  638. X{
  639. X}
  640. X
  641. Xdg10kclose()
  642. X
  643. X{
  644. X}
  645. X
  646. X#if    FLABEL
  647. Xfnclabel(f, n)        /* label a function key */
  648. X
  649. Xint f,n;    /* default flag, numeric argument [unused] */
  650. X
  651. X{
  652. X    /* on machines with no function keys...don't bother */
  653. X    return(TRUE);
  654. X}
  655. X#endif
  656. X#else
  657. Xdg10hello()
  658. X{
  659. X}
  660. X#endif
  661. END_OF_dg10.c
  662. if test 3266 -ne `wc -c <dg10.c`; then
  663.     echo shar: \"dg10.c\" unpacked with wrong size!
  664. fi
  665. # end of overwriting check
  666. fi
  667. echo shar: Extracting \"emacs.rc\" \(4818 characters\)
  668. if test -f emacs.rc ; then 
  669.   echo shar: Will not over-write existing file \"emacs.rc\"
  670. else
  671. sed "s/^X//" >emacs.rc <<'END_OF_emacs.rc'
  672. X;    EMACS.RC:    Startup file for MicroEMACS 3.8
  673. X;
  674. X;            This file is executed everytime the
  675. X;            editor is entered
  676. X
  677. X; If you screen "SNOWS", uncomment this line
  678. X;    set $flicker "TRUE"
  679. X
  680. X;    ***** Rebind the Function key group
  681. X
  682. Xbind-to-key search-forward        FN;
  683. Xbind-to-key search-reverse        FN<
  684. Xbind-to-key hunt-forward        FN=
  685. Xbind-to-key hunt-backward        FN>
  686. Xbind-to-key next-window            FN?
  687. Xbind-to-key execute-macro        FN@
  688. Xbind-to-key find-file            FNA
  689. Xbind-to-key execute-file        FNB
  690. Xbind-to-key save-file            FNC
  691. Xbind-to-key exit-emacs            FND
  692. X
  693. Xbind-to-key apropos            FNV
  694. Xbind-to-key describe-key        FNW
  695. Xbind-to-key fill-paragraph        FNX
  696. Xbind-to-key shell-command        FN\
  697. Xbind-to-key i-shell            FN]
  698. X
  699. X;    set screen colors
  700. Xadd-global-mode "blue"
  701. X
  702. X;    toggle function key window off
  703. X1 store-macro
  704. X    save-window
  705. X    1 next-window
  706. X    !if &sequal "Function Keys" $cbufname
  707. X        delete-window
  708. X    !endif
  709. X    bind-to-key execute-macro-14 FNT
  710. X!force    restore-window
  711. X    write-message "[Function key window OFF]"
  712. X!endm
  713. X
  714. X;    toggle function key window back on
  715. X14 store-macro
  716. X    1 next-window
  717. X    !if &sequal $cbufname "emacs.hlp"
  718. X        execute-macro-11
  719. X    !endif
  720. X    !if ¬ &sequal $cbufname "Function Keys"
  721. X        1 split-current-window
  722. X        select-buffer "Function Keys"
  723. X        add-mode "red"
  724. X!force        5 resize-window
  725. X        beginning-of-file
  726. X    !endif
  727. X    bind-to-key execute-macro-1 FNT
  728. X    2 next-window
  729. X    write-message "[Function key window ON]"
  730. X!endm
  731. X
  732. X;    Enter Help
  733. X2 store-macro
  734. X    1 next-window        ;Make sure the function key window isn't up!
  735. X    !if &sequal $cbufname "Function Keys"
  736. X        delete-window
  737. X        bind-to-key execute-macro-14 FNT
  738. X    !endif
  739. X    help
  740. X    8 resize-window
  741. X    bind-to-key execute-macro-12 FNI
  742. X    bind-to-key execute-macro-13 FNQ
  743. X    bind-to-key execute-macro-11 FNU
  744. X    bind-to-key execute-macro-15 ^XO
  745. X    bind-to-key execute-macro-15 ^XP
  746. X    bind-to-key execute-macro-15 FN?
  747. X    add-mode "red"
  748. X    beginning-of-file
  749. X    2 forward-character
  750. X    clear-message-line
  751. X!endm
  752. X
  753. X;    Exit Help
  754. X11 store-macro
  755. X    bind-to-key previous-page FNI
  756. X    bind-to-key next-page FNQ
  757. X    bind-to-key execute-macro-2 FNU
  758. X    bind-to-key next-window ^XO
  759. X    bind-to-key previous-window ^XP
  760. X    bind-to-key next-window FN?
  761. X    delete-window
  762. X    clear-message-line
  763. X!endm
  764. X
  765. X;    don't allow these commands from within the HELP screen
  766. X15    store-macro
  767. X    write-message "[Use F2 to exit HELP]!!"
  768. X!endm
  769. X
  770. X;    last help page
  771. X12 store-macro
  772. X    beginning-of-line
  773. X    search-reverse "=>"
  774. X    1 redraw-display
  775. X!endm
  776. X
  777. X;    next help page
  778. X13 store-macro
  779. X    beginning-of-line
  780. X    2 forward-character
  781. X    search-forward "=>"
  782. X    1 redraw-display
  783. X!endm
  784. X
  785. X;    reformat indented paragraph
  786. X
  787. X6 store-macro
  788. X    write-message "                    [Fixing paragraph]"
  789. X    kill-region
  790. X    2 split-current-window
  791. X    select-buffer "[temp]"
  792. X    yank
  793. X    beginning-of-file
  794. X    replace-string "~n    " "~n"
  795. X    write-message "                    [Fixing paragraph]"
  796. X    66 set-fill-column
  797. X    write-message "                    [Fixing paragraph]"
  798. X    fill-paragraph
  799. X    77 set-fill-column
  800. X    beginning-of-file
  801. X    handle-tab
  802. X    replace-string ~n "~n    "
  803. X    write-message "                    [Fixing paragraph]"
  804. X    end-of-file
  805. X    2 delete-previous-character
  806. X    beginning-of-file
  807. X    set-mark
  808. X    write-message "                    [Fixing paragraph]"
  809. X    end-of-file
  810. X    kill-region
  811. X    unmark-buffer
  812. X    delete-window
  813. X    yank
  814. X    delete-buffer "[temp]"
  815. X    write-message "                    [Fixed paragraph]"
  816. X!endm
  817. X
  818. X;    indent region
  819. X
  820. X7 store-macro
  821. X    write-message "                    [Indenting region]"
  822. X    kill-region
  823. X    2 split-current-window
  824. X    select-buffer "[temp]"
  825. X    yank
  826. X    beginning-of-file
  827. X    handle-tab
  828. X    replace-string "~n" "~n    "
  829. X    end-of-file
  830. X    4 delete-previous-character
  831. X    beginning-of-file
  832. X    set-mark
  833. X    write-message "                    [Indenting region]"
  834. X    end-of-file
  835. X    kill-region
  836. X    unmark-buffer
  837. X    delete-window
  838. X    yank
  839. X    delete-buffer "[temp]"
  840. X    write-message "                    [Region Indented]"
  841. X!endm
  842. X
  843. X;    undent region
  844. X
  845. X8 store-macro
  846. X    write-message "                    [Undenting region]"
  847. X    kill-region
  848. X    2 split-current-window
  849. X    select-buffer "[temp]"
  850. X    yank
  851. X    beginning-of-file
  852. X    delete-next-character
  853. X    replace-string "~n    " "~n"
  854. X    end-of-file
  855. X    2 delete-previous-character
  856. X    beginning-of-file
  857. X    set-mark
  858. X    write-message "                    [Undenting region]"
  859. X    end-of-file
  860. X    kill-region
  861. X    unmark-buffer
  862. X    delete-window
  863. X    yank
  864. X    delete-buffer "[temp]"
  865. X    write-message "                    [Region undented]"
  866. X!endm
  867. X
  868. X;    bring up the function key window
  869. X
  870. X    1 split-current-window
  871. X    select-buffer "Function Keys"
  872. X    add-mode "red"
  873. X    5 resize-window
  874. X    insert-string "f1 search      f2 search back | F1 toggle function list F2 toggle help file~n"
  875. X    insert-string "f3 hunt        f4 hunt back   | F3 find command/apropos F4 describe key~n"
  876. X    insert-string "f5 next window f6 exec macro  | F5 reformat paragraph   F6 ref undented region~n"
  877. X    insert-string "f7 find file   f8 exec file   | F7 indent region        F8 undent region~n"
  878. X    insert-string "f9 save file  f10 exit emacs  | F9 execute DOS command F10 shell up~n"
  879. X    beginning-of-file
  880. X    unmark-buffer
  881. X    next-window
  882. END_OF_emacs.rc
  883. if test 4818 -ne `wc -c <emacs.rc`; then
  884.     echo shar: \"emacs.rc\" unpacked with wrong size!
  885. fi
  886. # end of overwriting check
  887. fi
  888. echo shar: Extracting \"epath.h\" \(780 characters\)
  889. if test -f epath.h ; then 
  890.   echo shar: Will not over-write existing file \"epath.h\"
  891. else
  892. sed "s/^X//" >epath.h <<'END_OF_epath.h'
  893. X/*    PATH:    This file contains certain info needed to locate the
  894. X        MicroEMACS files on a system dependant basis.
  895. X
  896. X                                    */
  897. X
  898. X/*    possible names and paths of help files under different OSs    */
  899. X
  900. Xchar *pathname[] =
  901. X
  902. X#if    AMIGA
  903. X{
  904. X    ".emacsrc",
  905. X    "emacs.hlp",
  906. X    "",
  907. X    ":c/",
  908. X    ":t/"
  909. X};
  910. X#endif
  911. X
  912. X#if    ST520
  913. X{
  914. X    "emacs.rc",
  915. X    "emacs.hlp",
  916. X    "\\",
  917. X    "\\bin\\",
  918. X    "\\util\\",
  919. X    ""
  920. X};
  921. X#endif
  922. X
  923. X#if    FINDER
  924. X{
  925. X    "emacs.rc",
  926. X    "emacs.hlp",
  927. X    "/bin",
  928. X    "/sys/public",
  929. X    ""
  930. X};
  931. X#endif
  932. X
  933. X#if    MSDOS
  934. X{
  935. X    "emacs.rc",
  936. X    "emacs.hlp",
  937. X    "\\sys\\public\\",
  938. X    "\\usr\\bin\\",
  939. X    "\\bin\\",
  940. X    "\\",
  941. X    ""
  942. X};
  943. X#endif
  944. X
  945. X#if    V7 | BSD | USG
  946. X{
  947. X    ".emacsrc",
  948. X    "emacs.hlp",
  949. X    "/usr/local/",
  950. X    "/usr/lib/",
  951. X    ""
  952. X};
  953. X#endif
  954. X
  955. X#if    VMS
  956. X{
  957. X    "emacs.rc",
  958. X    "emacs.hlp",
  959. X    "",
  960. X    "sys$sysdevice:[vmstools]"
  961. X};
  962. X#endif
  963. X
  964. X#define    NPNAMES    (sizeof(pathname)/sizeof(char *))
  965. END_OF_epath.h
  966. if test 780 -ne `wc -c <epath.h`; then
  967.     echo shar: \"epath.h\" unpacked with wrong size!
  968. fi
  969. # end of overwriting check
  970. fi
  971. echo shar: Extracting \"esearch.h\" \(2286 characters\)
  972. if test -f esearch.h ; then 
  973.   echo shar: Will not over-write existing file \"esearch.h\"
  974. else
  975. sed "s/^X//" >esearch.h <<'END_OF_esearch.h'
  976. X/*
  977. X * ESEARCH.H
  978. X *
  979. X * Defines, typdefs, and global variables that are of use for the
  980. X * routines in search.c and isearch.c.
  981. X *
  982. X */
  983. X
  984. X/*
  985. X * PTBEG, PTEND, FORWARD, and REVERSE are all toggle-able values for
  986. X * the scan routines.
  987. X */
  988. X#define    PTBEG    0    /* Leave the point at the beginning on search.*/
  989. X#define    PTEND    1    /* Leave the point at the end on search.*/
  990. X
  991. X#if    MAGIC
  992. X
  993. X/*
  994. X * Defines for the metacharacters in the regular expressions.
  995. X */
  996. X
  997. X#define    MCNIL        0    /* Like the '\0' for strings.*/
  998. X#define    LITCHAR        1
  999. X#define    ANY        2
  1000. X#define    CCL        3
  1001. X#define    NCCL        4
  1002. X#define    BOL        5
  1003. X#define    EOL        6
  1004. X#define    CLOSURE        256    /* An or-able value.*/
  1005. X#define    MASKCL        CLOSURE - 1
  1006. X
  1007. X#define    MC_ANY        '.'    /* 'Any' character (except newline).*/
  1008. X#define    MC_CCL        '['    /* Character class.*/
  1009. X#define    MC_NCCL        '^'    /* Negate character class.*/
  1010. X#define    MC_RCCL        '-'    /* Range in character class.*/
  1011. X#define    MC_ECCL        ']'    /* End of character class.*/
  1012. X#define    MC_BOL        '^'    /* Beginning of line.*/
  1013. X#define    MC_EOL        '$'    /* End of line.*/
  1014. X#define    MC_CLOSURE    '*'    /* Closure - does not extend past newline.*/
  1015. X
  1016. X#define    MC_ESC        '\\'    /* Escape - suppress meta-meaning.*/
  1017. X
  1018. X#define    BIT(n)        (1 << (n))    /* An integer with one bit set.*/
  1019. X#define    CHCASE(c)    ((c) ^ DIFCASE)    /* Toggle the case of a letter.*/
  1020. X
  1021. X/* HICHAR - 1 is the largest character we will deal with.
  1022. X * HIBYTE represents the number of bytes in the bitmap.
  1023. X */
  1024. X
  1025. X#define    HICHAR        256
  1026. X#define    HIBYTE        HICHAR >> 3
  1027. X
  1028. Xtypedef char    *BITMAP;
  1029. X
  1030. Xtypedef    struct {
  1031. X    short int    mc_type;
  1032. X    union {
  1033. X        int    lchar;
  1034. X        BITMAP    cclmap;
  1035. X    } u;
  1036. X} MC;
  1037. X#endif
  1038. X
  1039. X/* Incremental search defines.
  1040. X */
  1041. X#if    ISRCH
  1042. X#define    CMDBUFLEN    256    /* Length of our command buffer */
  1043. X
  1044. X#define    IS_ABORT    0x07    /* Abort the isearch */
  1045. X#define IS_BACKSP    0x08    /* Delete previous char */
  1046. X#define    IS_TAB        0x09    /* Tab character (allowed search char) */
  1047. X#define IS_NEWLINE    0x0D    /* New line from keyboard (Carriage return) */
  1048. X#define    IS_QUOTE    0x11    /* Quote next character */
  1049. X#define IS_REVERSE    0x12    /* Search backward */
  1050. X#define    IS_FORWARD    0x13    /* Search forward */
  1051. X#define    IS_VMSQUOTE    0x16    /* VMS quote character */
  1052. X#define    IS_VMSFORW    0x18    /* Search forward for VMS */
  1053. X#define    IS_QUIT        0x1B    /* Exit the search */
  1054. X#define    IS_RUBOUT    0x7F    /* Delete previous character */
  1055. X
  1056. X/* IS_QUIT is no longer used, the variable metac is used instead */
  1057. X
  1058. X#endif
  1059. END_OF_esearch.h
  1060. if test 2286 -ne `wc -c <esearch.h`; then
  1061.     echo shar: \"esearch.h\" unpacked with wrong size!
  1062. fi
  1063. # end of overwriting check
  1064. fi
  1065. echo shar: Extracting \"evar.h\" \(2763 characters\)
  1066. if test -f evar.h ; then 
  1067.   echo shar: Will not over-write existing file \"evar.h\"
  1068. else
  1069. sed "s/^X//" >evar.h <<'END_OF_evar.h'
  1070. X/*    EVAR.H:    Environment and user variable definitions
  1071. X        for MicroEMACS
  1072. X
  1073. X        written 1986 by Daniel Lawrence
  1074. X*/
  1075. X
  1076. X/*    structure to hold user variables and their definitions    */
  1077. X
  1078. Xtypedef struct UVAR {
  1079. X    char u_name[NVSIZE + 1];        /* name of user variable */
  1080. X    char *u_value;                /* value (string) */
  1081. X} UVAR;
  1082. X
  1083. X/*    current user variables (This structure will probably change)    */
  1084. X
  1085. X#define    MAXVARS        100
  1086. X
  1087. XUVAR uv[MAXVARS];    /* user variables */
  1088. X
  1089. X/*    list of recognized environment variables    */
  1090. X
  1091. Xchar *envars[] = {
  1092. X    "fillcol",        /* current fill column */
  1093. X    "pagelen",        /* number of lines used by editor */
  1094. X    "curcol",        /* current column pos of cursor */
  1095. X    "curline",        /* current line in file */
  1096. X    "ram",            /* ram in use by malloc */
  1097. X    "flicker",        /* flicker supression */
  1098. X    "curwidth",        /* current screen width */
  1099. X    "cbufname",        /* current buffer name */
  1100. X    "cfname",        /* current file name */
  1101. X    "sres",            /* current screen resolution */
  1102. X    "debug",        /* macro debugging */
  1103. X    "status",        /* returns the status of the last command */
  1104. X};
  1105. X
  1106. X#define    NEVARS    sizeof(envars) / sizeof(char *)
  1107. X
  1108. X/*     and its preprocesor definitions        */
  1109. X
  1110. X#define    EVFILLCOL    0
  1111. X#define    EVPAGELEN    1
  1112. X#define    EVCURCOL    2
  1113. X#define    EVCURLINE    3
  1114. X#define    EVRAM        4
  1115. X#define    EVFLICKER    5
  1116. X#define    EVCURWIDTH    6
  1117. X#define    EVCBUFNAME    7
  1118. X#define    EVCFNAME    8
  1119. X#define    EVSRES        9
  1120. X#define    EVDEBUG        10
  1121. X#define    EVSTATUS    11
  1122. X
  1123. X/*    list of recognized user functions    */
  1124. X
  1125. Xtypedef struct UFUNC {
  1126. X    char *f_name;    /* name of function */
  1127. X    int f_type;    /* 1 = monamic, 2 = dynamic */
  1128. X} UFUNC;
  1129. X
  1130. X#define    MONAMIC        1
  1131. X#define    DYNAMIC        2
  1132. X#define    TRINAMIC    3
  1133. X
  1134. XUFUNC funcs[] = {
  1135. X    "add", DYNAMIC,        /* add two numbers together */
  1136. X    "sub", DYNAMIC,        /* subtraction */
  1137. X    "tim", DYNAMIC,        /* multiplication */
  1138. X    "div", DYNAMIC,        /* division */
  1139. X    "mod", DYNAMIC,        /* mod */
  1140. X    "neg", MONAMIC,        /* negate */
  1141. X    "cat", DYNAMIC,        /* concatinate string */
  1142. X    "lef", DYNAMIC,        /* left string(string, len) */
  1143. X    "rig", DYNAMIC,        /* right string(string, pos) */
  1144. X    "mid", TRINAMIC,    /* mid string(string, pos, len) */
  1145. X    "not", MONAMIC,        /* logical not */
  1146. X    "equ", DYNAMIC,        /* logical equality check */
  1147. X    "les", DYNAMIC,        /* logical less than */
  1148. X    "gre", DYNAMIC,        /* logical greater than */
  1149. X    "seq", DYNAMIC,        /* string logical equality check */
  1150. X    "sle", DYNAMIC,        /* string logical less than */
  1151. X    "sgr", DYNAMIC,        /* string logical greater than */
  1152. X    "ind", MONAMIC,        /* evaluate indirect value */
  1153. X};
  1154. X
  1155. X#define    NFUNCS    sizeof(funcs) / sizeof(char *)
  1156. X
  1157. X/*     and its preprocesor definitions        */
  1158. X
  1159. X#define    UFADD        0
  1160. X#define    UFSUB        1
  1161. X#define    UFTIMES        2
  1162. X#define    UFDIV        3
  1163. X#define    UFMOD        4
  1164. X#define    UFNEG        5
  1165. X#define    UFCAT        6
  1166. X#define    UFLEFT        7
  1167. X#define    UFRIGHT        8
  1168. X#define    UFMID        9
  1169. X#define    UFNOT        10
  1170. X#define    UFEQUAL        11
  1171. X#define    UFLESS        12
  1172. X#define    UFGREATER    13
  1173. X#define    UFSEQUAL    14
  1174. X#define    UFSLESS        15
  1175. X#define    UFSGREAT    16
  1176. X#define    UFIND        17
  1177. END_OF_evar.h
  1178. if test 2763 -ne `wc -c <evar.h`; then
  1179.     echo shar: \"evar.h\" unpacked with wrong size!
  1180. fi
  1181. # end of overwriting check
  1182. fi
  1183. echo shar: Extracting \"fileio.c\" \(3492 characters\)
  1184. if test -f fileio.c ; then 
  1185.   echo shar: Will not over-write existing file \"fileio.c\"
  1186. else
  1187. sed "s/^X//" >fileio.c <<'END_OF_fileio.c'
  1188. X/*
  1189. X * The routines in this file read and write ASCII files from the disk. All of
  1190. X * the knowledge about files are here. A better message writing scheme should
  1191. X * be used.
  1192. X */
  1193. X#include        <stdio.h>
  1194. X#include    "estruct.h"
  1195. X#include        "edef.h"
  1196. X
  1197. X#if    MEGAMAX
  1198. Xoverlay "fileio"
  1199. X#endif
  1200. X
  1201. XFILE    *ffp;                           /* File pointer, all functions. */
  1202. X
  1203. X/*
  1204. X * Open a file for reading.
  1205. X */
  1206. Xffropen(fn)
  1207. Xchar    *fn;
  1208. X{
  1209. X        if ((ffp=fopen(fn, "r")) == NULL)
  1210. X                return (FIOFNF);
  1211. X        return (FIOSUC);
  1212. X}
  1213. X
  1214. X/*
  1215. X * Open a file for writing. Return TRUE if all is well, and FALSE on error
  1216. X * (cannot create).
  1217. X */
  1218. Xffwopen(fn)
  1219. Xchar    *fn;
  1220. X{
  1221. X#if     VMS
  1222. X        register int    fd;
  1223. X
  1224. X        if ((fd=creat(fn, 0666, "rfm=var", "rat=cr")) < 0
  1225. X        || (ffp=fdopen(fd, "w")) == NULL) {
  1226. X#else
  1227. X        if ((ffp=fopen(fn, "w")) == NULL) {
  1228. X#endif
  1229. X                mlwrite("Cannot open file for writing");
  1230. X                return (FIOERR);
  1231. X        }
  1232. X        return (FIOSUC);
  1233. X}
  1234. X
  1235. X/*
  1236. X * Close a file. Should look at the status in all systems.
  1237. X */
  1238. Xffclose()
  1239. X{
  1240. X#if    MSDOS & CTRLZ
  1241. X    fputc(26, ffp);        /* add a ^Z at the end of the file */
  1242. X#endif
  1243. X    
  1244. X#if     V7 | USG | BSD | (MSDOS & (LATTICE | MSC))
  1245. X        if (fclose(ffp) != FALSE) {
  1246. X                mlwrite("Error closing file");
  1247. X                return(FIOERR);
  1248. X        }
  1249. X        return(FIOSUC);
  1250. X#else
  1251. X        fclose(ffp);
  1252. X        return (FIOSUC);
  1253. X#endif
  1254. X}
  1255. X
  1256. X/*
  1257. X * Write a line to the already opened file. The "buf" points to the buffer,
  1258. X * and the "nbuf" is its length, less the free newline. Return the status.
  1259. X * Check only at the newline.
  1260. X */
  1261. Xffputline(buf, nbuf)
  1262. Xchar    buf[];
  1263. X{
  1264. X        register int    i;
  1265. X#if    CRYPT
  1266. X    char c;        /* character to translate */
  1267. X
  1268. X    if (cryptflag) {
  1269. X            for (i = 0; i < nbuf; ++i) {
  1270. X            c = buf[i] & 0xff;
  1271. X            crypt(&c, 1);
  1272. X            fputc(c, ffp);
  1273. X        }
  1274. X    } else
  1275. X            for (i = 0; i < nbuf; ++i)
  1276. X                    fputc(buf[i]&0xFF, ffp);
  1277. X#else
  1278. X        for (i = 0; i < nbuf; ++i)
  1279. X                fputc(buf[i]&0xFF, ffp);
  1280. X#endif
  1281. X
  1282. X#if    ST520
  1283. X        fputc('\r', ffp);
  1284. X#endif        
  1285. X        fputc('\n', ffp);
  1286. X
  1287. X        if (ferror(ffp)) {
  1288. X                mlwrite("Write I/O error");
  1289. X                return (FIOERR);
  1290. X        }
  1291. X
  1292. X        return (FIOSUC);
  1293. X}
  1294. X
  1295. X/*
  1296. X * Read a line from a file, and store the bytes in the supplied buffer. The
  1297. X * "nbuf" is the length of the buffer. Complain about long lines and lines
  1298. X * at the end of the file that don't have a newline present. Check for I/O
  1299. X * errors too. Return status.
  1300. X */
  1301. Xffgetline(buf, nbuf)
  1302. Xregister char   buf[];
  1303. X{
  1304. X        register int    c;
  1305. X        register int    i;
  1306. X
  1307. X        i = 0;
  1308. X
  1309. X        while ((c = fgetc(ffp)) != EOF && c != '\n') {
  1310. X                if (i >= nbuf-2) {
  1311. X            buf[nbuf - 2] = c;    /* store last char read */
  1312. X            buf[nbuf - 1] = 0;    /* and terminate it */
  1313. X                        mlwrite("File has long line");
  1314. X#if    CRYPT
  1315. X            if (cryptflag)
  1316. X                crypt(buf, strlen(buf));
  1317. X#endif
  1318. X                        return (FIOLNG);
  1319. X                }
  1320. X                buf[i++] = c;
  1321. X        }
  1322. X
  1323. X#if    ST520
  1324. X    if(buf[i-1] == '\r')
  1325. X        i--;
  1326. X#endif
  1327. X        if (c == EOF) {
  1328. X                if (ferror(ffp)) {
  1329. X                        mlwrite("File read error");
  1330. X                        return (FIOERR);
  1331. X                }
  1332. X
  1333. X                if (i != 0) {
  1334. X                    buf[i] = 0;
  1335. X                        return(FIOFUN);
  1336. X                }
  1337. X
  1338. X                return (FIOEOF);
  1339. X        }
  1340. X
  1341. X        buf[i] = 0;
  1342. X#if    CRYPT
  1343. X    if (cryptflag)
  1344. X        crypt(buf, strlen(buf));
  1345. X#endif
  1346. X        return (FIOSUC);
  1347. X}
  1348. END_OF_fileio.c
  1349. if test 3492 -ne `wc -c <fileio.c`; then
  1350.     echo shar: \"fileio.c\" unpacked with wrong size!
  1351. fi
  1352. # end of overwriting check
  1353. fi
  1354. echo shar: Extracting \"hp110.c\" \(3687 characters\)
  1355. if test -f hp110.c ; then 
  1356.   echo shar: Will not over-write existing file \"hp110.c\"
  1357. else
  1358. sed "s/^X//" >hp110.c <<'END_OF_hp110.c'
  1359. X/*
  1360. X *    HP110:    Hewlett Packard 110 Screen Driver
  1361. X */
  1362. X
  1363. X#define    termdef    1            /* don't define "term" external */
  1364. X
  1365. X#include        <stdio.h>
  1366. X#include    "estruct.h"
  1367. X#include        "edef.h"
  1368. X
  1369. X#if     HP110
  1370. X
  1371. X#define NROW    16                      /* Screen size.                 */
  1372. X#define NCOL    80                      /* Edit if you want to.         */
  1373. X#define    NPAUSE    100            /* # times thru update to pause */
  1374. X#define    MARGIN    8            /* size of minimim margin and    */
  1375. X#define    SCRSIZ    64            /* scroll size for extended lines */
  1376. X#define BEL     0x07                    /* BEL character.               */
  1377. X#define ESC     0x1B                    /* ESC character.               */
  1378. X
  1379. Xextern  int     ttopen();               /* Forward references.          */
  1380. Xextern  int     ttgetc();
  1381. Xextern  int     ttputc();
  1382. Xextern  int     ttflush();
  1383. Xextern  int     ttclose();
  1384. Xextern  int     h110move();
  1385. Xextern  int     h110eeol();
  1386. Xextern  int     h110eeop();
  1387. Xextern  int     h110beep();
  1388. Xextern  int     h110open();
  1389. Xextern    int    h110rev();
  1390. Xextern    int    h110cres();
  1391. Xextern    int    h110close();
  1392. Xextern    int    h110kopen();
  1393. Xextern    int    h110kclose();
  1394. X
  1395. X#if    COLOR
  1396. Xextern    int    h110fcol();
  1397. Xextern    int    h110bcol();
  1398. X
  1399. Xint    cfcolor = -1;        /* current forground color */
  1400. Xint    cbcolor = -1;        /* current background color */
  1401. X#endif
  1402. X
  1403. X/*
  1404. X * Standard terminal interface dispatch table. Most of the fields point into
  1405. X * "termio" code.
  1406. X */
  1407. XTERM    term    = {
  1408. X    NROW-1,
  1409. X        NROW-1,
  1410. X        NCOL,
  1411. X        NCOL,
  1412. X    MARGIN,
  1413. X    SCRSIZ,
  1414. X    NPAUSE,
  1415. X        h110open,
  1416. X        h110close,
  1417. X    h110kopen,
  1418. X    h110kclose,
  1419. X        ttgetc,
  1420. X        ttputc,
  1421. X        ttflush,
  1422. X        h110move,
  1423. X        h110eeol,
  1424. X        h110eeop,
  1425. X        h110beep,
  1426. X    h110rev,
  1427. X    h110cres
  1428. X#if    COLOR
  1429. X    , h110fcol,
  1430. X    h110bcol
  1431. X#endif
  1432. X};
  1433. X
  1434. X#if    COLOR
  1435. Xh110fcol(color)        /* set the current output color */
  1436. X
  1437. Xint color;    /* color to set */
  1438. X
  1439. X{
  1440. X    if (color == cfcolor)
  1441. X        return;
  1442. X    ttputc(ESC);
  1443. X    ttputc('[');
  1444. X    h110parm(color+30);
  1445. X    ttputc('m');
  1446. X    cfcolor = color;
  1447. X}
  1448. X
  1449. Xh110bcol(color)        /* set the current background color */
  1450. X
  1451. Xint color;    /* color to set */
  1452. X
  1453. X{
  1454. X    if (color == cbcolor)
  1455. X        return;
  1456. X    ttputc(ESC);
  1457. X    ttputc('[');
  1458. X    h110parm(color+40);
  1459. X    ttputc('m');
  1460. X        cbcolor = color;
  1461. X}
  1462. X#endif
  1463. X
  1464. Xh110move(row, col)
  1465. X{
  1466. X        ttputc(ESC);
  1467. X        ttputc('[');
  1468. X        h110parm(row+1);
  1469. X        ttputc(';');
  1470. X        h110parm(col+1);
  1471. X        ttputc('H');
  1472. X}
  1473. X
  1474. Xh110eeol()
  1475. X{
  1476. X        ttputc(ESC);
  1477. X        ttputc('[');
  1478. X    ttputc('0');
  1479. X        ttputc('K');
  1480. X}
  1481. X
  1482. Xh110eeop()
  1483. X{
  1484. X#if    COLOR
  1485. X    h110fcol(gfcolor);
  1486. X    h110bcol(gbcolor);
  1487. X#endif
  1488. X        ttputc(ESC);
  1489. X        ttputc('[');
  1490. X    ttputc('0');
  1491. X        ttputc('J');
  1492. X}
  1493. X
  1494. Xh110rev(state)        /* change reverse video state */
  1495. X
  1496. Xint state;    /* TRUE = reverse, FALSE = normal */
  1497. X
  1498. X{
  1499. X#if    COLOR
  1500. X    int ftmp, btmp;        /* temporaries for colors */
  1501. X#endif
  1502. X
  1503. X    ttputc(ESC);
  1504. X    ttputc('[');
  1505. X    ttputc(state ? '7': '0');
  1506. X    ttputc('m');
  1507. X#if    COLOR
  1508. X    if (state == FALSE) {
  1509. X        ftmp = cfcolor;
  1510. X        btmp = cbcolor;
  1511. X        cfcolor = -1;
  1512. X        cbcolor = -1;
  1513. X        h110fcol(ftmp);
  1514. X        h110bcol(btmp);
  1515. X    }
  1516. X#endif
  1517. X}
  1518. X
  1519. Xh110cres()    /* change screen resolution */
  1520. X
  1521. X{
  1522. X    return(TRUE);
  1523. X}
  1524. X
  1525. Xh110beep()
  1526. X{
  1527. X        ttputc(BEL);
  1528. X        ttflush();
  1529. X}
  1530. X
  1531. Xh110parm(n)
  1532. Xregister int    n;
  1533. X{
  1534. X        register int q,r;
  1535. X
  1536. X        q = n/10;
  1537. X        if (q != 0) {
  1538. X        r = q/10;
  1539. X        if (r != 0) {
  1540. X            ttputc((r%10)+'0');
  1541. X        }
  1542. X        ttputc((q%10) + '0');
  1543. X        }
  1544. X        ttputc((n%10) + '0');
  1545. X}
  1546. X
  1547. Xh110open()
  1548. X{
  1549. X    strcpy(sres, "15LINE");
  1550. X    revexist = TRUE;
  1551. X        ttopen();
  1552. X}
  1553. X
  1554. Xh110close()
  1555. X
  1556. X{
  1557. X#if    COLOR
  1558. X    h110fcol(7);
  1559. X    h110bcol(0);
  1560. X#endif
  1561. X    ttclose();
  1562. X}
  1563. X
  1564. Xh110kopen()
  1565. X
  1566. X{
  1567. X}
  1568. X
  1569. Xh110kclose()
  1570. X
  1571. X{
  1572. X}
  1573. X
  1574. X#if    FLABEL
  1575. Xfnclabel(f, n)        /* label a function key */
  1576. X
  1577. Xint f,n;    /* default flag, numeric argument [unused] */
  1578. X
  1579. X{
  1580. X    /* on machines with no function keys...don't bother */
  1581. X    return(TRUE);
  1582. X}
  1583. X#endif
  1584. X#else
  1585. Xh110hello()
  1586. X{
  1587. X}
  1588. X#endif
  1589. END_OF_hp110.c
  1590. if test 3687 -ne `wc -c <hp110.c`; then
  1591.     echo shar: \"hp110.c\" unpacked with wrong size!
  1592. fi
  1593. # end of overwriting check
  1594. fi
  1595. echo shar: Extracting \"ibmfn.lst\" \(593 characters\)
  1596. if test -f ibmfn.lst ; then 
  1597.   echo shar: Will not over-write existing file \"ibmfn.lst\"
  1598. else
  1599. sed "s/^X//" >ibmfn.lst <<'END_OF_ibmfn.lst'
  1600. X            IBM PC function keys in MicroEmacs
  1601. X
  1602. X    function    Function    ^function    Alt-function
  1603. X f1)      FN;          FNT          FN^          FNh
  1604. X f2)      FN<          FNU          FN_          FNi
  1605. X f3)      FN=          FNV          FN`          FNj
  1606. X f4)      FN>          FNW          FNa          FNk
  1607. X f5)      FN?          FNX          FNb          FNl
  1608. X f6)      FN@          FNY          FNc          FNm
  1609. X f7)      FNA          FNZ          FNd          FNn
  1610. X f8)      FNB          FN[          FNe          FNo
  1611. X f9)      FNC          FN\          FNf          FNp
  1612. Xf10)      FND          FN]          FNg          FNq
  1613. X
  1614. Xhome)      FNG                  FNw
  1615. XCuUp)      FNH
  1616. XPgUp)      FNI                  FN^D {Alt 132}
  1617. XCuLf)      FNK                  FNs
  1618. X 5  )
  1619. XCuRt)      FNM                  FNt
  1620. X End)      FNO                  FNu
  1621. XCuDn)      FNP
  1622. XPgDn)      FNQ                  FNv
  1623. X Ins)      FNR
  1624. X Del)      FNS
  1625. END_OF_ibmfn.lst
  1626. if test 593 -ne `wc -c <ibmfn.lst`; then
  1627.     echo shar: \"ibmfn.lst\" unpacked with wrong size!
  1628. fi
  1629. # end of overwriting check
  1630. fi
  1631. echo shar: Extracting \"lock.c\" \(3565 characters\)
  1632. if test -f lock.c ; then 
  1633.   echo shar: Will not over-write existing file \"lock.c\"
  1634. else
  1635. sed "s/^X//" >lock.c <<'END_OF_lock.c'
  1636. X/*    LOCK:    File locking command routines for MicroEMACS
  1637. X        written by Daniel Lawrence
  1638. X                                */
  1639. X
  1640. X#include <stdio.h>
  1641. X#include "estruct.h"
  1642. X#include "edef.h"
  1643. X
  1644. X#if    FILOCK
  1645. X#if    BSD
  1646. X#include <sys/errno.h>
  1647. X
  1648. Xextern int sys_nerr;        /* number of system error messages defined */
  1649. Xextern char *sys_errlist[];    /* list of message texts */
  1650. Xextern int errno;        /* current error */
  1651. X
  1652. Xchar *lname[NLOCKS];    /* names of all locked files */
  1653. Xint numlocks;        /* # of current locks active */
  1654. X
  1655. X/* lockchk:    check a file for locking and add it to the list */
  1656. X
  1657. Xlockchk(fname)
  1658. X
  1659. Xchar *fname;    /* file to check for a lock */
  1660. X
  1661. X{
  1662. X    register int i;        /* loop indexes */
  1663. X    register int status;    /* return status */
  1664. X    char *undolock();
  1665. X
  1666. X    /* check to see if that file is already locked here */
  1667. X    if (numlocks > 0)
  1668. X        for (i=0; i < numlocks; ++i)
  1669. X            if (strcmp(fname, lname[i]) == 0)
  1670. X                return(TRUE);
  1671. X
  1672. X    /* if we have a full locking table, bitch and leave */
  1673. X    if (numlocks == NLOCKS) {
  1674. X        mlwrite("LOCK ERROR: Lock table full");
  1675. X        return(ABORT);
  1676. X    }
  1677. X
  1678. X    /* next, try to lock it */
  1679. X    status = lock(fname);
  1680. X    if (status == ABORT)    /* file is locked, no override */
  1681. X        return(ABORT);
  1682. X    if (status == FALSE)    /* locked, overriden, dont add to table */
  1683. X        return(TRUE);
  1684. X
  1685. X    /* we have now locked it, add it to our table */
  1686. X    lname[++numlocks - 1] = (char *)malloc(strlen(fname) + 1);
  1687. X    if (lname[numlocks - 1] == NULL) {    /* malloc failure */
  1688. X        undolock(fname);        /* free the lock */
  1689. X        mlwrite("Cannot lock, out of memory");
  1690. X        --numlocks;
  1691. X        return(ABORT);
  1692. X    }
  1693. X
  1694. X    /* everthing is cool, add it to the table */
  1695. X    strcpy(lname[numlocks-1], fname);
  1696. X    return(TRUE);
  1697. X}
  1698. X
  1699. X/*    lockrel:    release all the file locks so others may edit */
  1700. X
  1701. Xlockrel()
  1702. X
  1703. X{
  1704. X    register int i;        /* loop index */
  1705. X    register int status;    /* status of locks */
  1706. X    register int s;        /* status of one unlock */
  1707. X
  1708. X    status = TRUE;
  1709. X    if (numlocks > 0)
  1710. X        for (i=0; i < numlocks; ++i) {
  1711. X            if ((s = unlock(lname[i])) != TRUE)
  1712. X                status = s;
  1713. X            free(lname[i]);
  1714. X        }
  1715. X    numlocks = 0;
  1716. X    return(status);
  1717. X}
  1718. X
  1719. X/* lock:    Check and lock a file from access by others
  1720. X        returns    TRUE = files was not locked and now is
  1721. X            FALSE = file was locked and overridden
  1722. X            ABORT = file was locked, abort command
  1723. X*/
  1724. X
  1725. Xlock(fname)
  1726. X
  1727. Xchar *fname;    /* file name to lock */
  1728. X
  1729. X{
  1730. X    register char *locker;    /* lock error message */
  1731. X    register int status;    /* return status */
  1732. X    char msg[NSTRING];    /* message string */
  1733. X    char *dolock();
  1734. X
  1735. X    /* attempt to lock the file */
  1736. X    locker = dolock(fname);
  1737. X    if (locker == NULL)    /* we win */
  1738. X        return(TRUE);
  1739. X
  1740. X    /* file failed...abort */
  1741. X    if (strncmp(locker, "LOCK", 4) == 0) {
  1742. X        lckerror(locker);
  1743. X        return(ABORT);
  1744. X    }
  1745. X
  1746. X    /* someone else has it....override? */
  1747. X    strcpy(msg, "File in use by ");
  1748. X    strcat(msg, locker);
  1749. X    strcat(msg, ", overide?");
  1750. X    status = mlyesno(msg);        /* ask them */
  1751. X    if (status == TRUE)
  1752. X        return(FALSE);
  1753. X    else
  1754. X        return(ABORT);
  1755. X}
  1756. X
  1757. X/*    unlock:    Unlock a file
  1758. X        this only warns the user if it fails
  1759. X                            */
  1760. X
  1761. Xunlock(fname)
  1762. X
  1763. Xchar *fname;    /* file to unlock */
  1764. X
  1765. X{
  1766. X    register char *locker;    /* undolock return string */
  1767. X    char *undolock();
  1768. X
  1769. X    /* unclock and return */
  1770. X    locker = undolock(fname);
  1771. X    if (locker == NULL)
  1772. X        return(TRUE);
  1773. X
  1774. X    /* report the error and come back */
  1775. X    lckerror(locker);
  1776. X    return(FALSE);
  1777. X}
  1778. X
  1779. Xlckerror(errstr)    /* report a lock error */
  1780. X
  1781. Xchar *errstr;        /* lock error string to print out */
  1782. X
  1783. X{
  1784. X    char obuf[NSTRING];    /* output buffer for error message */
  1785. X
  1786. X    strcpy(obuf, errstr);
  1787. X    strcat(obuf, " - ");
  1788. X    if (errno < sys_nerr)
  1789. X        strcat(obuf, sys_errlist[errno]);
  1790. X    else
  1791. X        strcat(obuf, "[can not get system error message]");
  1792. X    mlwrite(obuf);
  1793. X}
  1794. X#endif
  1795. X#else
  1796. Xlckhello()    /* dummy function */
  1797. X{
  1798. X}
  1799. X#endif
  1800. END_OF_lock.c
  1801. if test 3565 -ne `wc -c <lock.c`; then
  1802.     echo shar: \"lock.c\" unpacked with wrong size!
  1803. fi
  1804. # end of overwriting check
  1805. fi
  1806. echo shar: Extracting \"magic.doc\" \(3923 characters\)
  1807. if test -f magic.doc ; then 
  1808.   echo shar: Will not over-write existing file \"magic.doc\"
  1809. else
  1810. sed "s/^X//" >magic.doc <<'END_OF_magic.doc'
  1811. X
  1812. X        Some notes on the MAGIC mode.
  1813. X
  1814. X     In the MAGIC mode of MicroEmacs (versions 3.8 and up),
  1815. Xcertain characters gain special meanings when used in a search
  1816. Xpattern.  Collectively they are know as regular expressions,
  1817. Xand a limited number of them are supported in MicroEmacs.
  1818. XThey grant greater flexability when using the search command.
  1819. XHowever, they do not affect the incremental search command.
  1820. X
  1821. X     The symbols that have special meaning in MAGIC mode are
  1822. X^, $, ., *, [ (and ], used with it), and \.
  1823. X
  1824. X     The characters ^ and $ fix the search pattern to the
  1825. Xbeginning and end of line, respectively.  The ^ character
  1826. Xmust appear at the beginning of the search string, and the
  1827. X$ must appear at the end, otherwise they loose their
  1828. Xmeaning and are treated just like any other character.
  1829. XFor example, in MAGIC mode, searching for the pattern
  1830. X"t$" would put the cursor at the end of any line that ended
  1831. Xwith the letter 't'.  Note that this is different than
  1832. Xsearching for "t<NL>", that is, 't' followed by a newline
  1833. Xcharacter.  The character $ (and ^, for that matter) matches
  1834. Xa position, not a character, so the cursor remains at the end
  1835. Xof the line.  But a newline is a character that must be matched,
  1836. Xjust like any other character, which means that the cursor is
  1837. Xplaced just after it - on the beginning of the next line.
  1838. X
  1839. X     The character . has a very simple meaning - it matches
  1840. Xany single character, except the newline.  Thus a search for
  1841. X"bad.er" could match "badger", "badder" (slang), or up to the
  1842. X'r' of "bad error".
  1843. X
  1844. X     The character * is known as closure, and means that zero
  1845. Xor more of the preceding character will match.  If there is
  1846. Xno character preceding, * has no special meaning, and since
  1847. Xit will not match with a newline, * will have no special
  1848. Xmeaning if preceded by the beginning of line symbol ^ or
  1849. Xthe literal newline character <NL>.
  1850. X     The notion of zero or more characters is important.
  1851. XIf, for example, your cursor was on the line
  1852. X
  1853. X    This line is missing two vowels.
  1854. X
  1855. Xand a search was made for "a*", the cursor would not move,
  1856. Xbecause it is guarenteed to match no letter 'a' , which
  1857. Xsatifies the search conditions.  If you wanted to search
  1858. Xfor one or more of the letter 'a', you would search for
  1859. X"aa*", which would match the letter a, then zero or more of
  1860. Xthem.
  1861. X
  1862. X     The character [ indicates the beginning of a character
  1863. Xclass.  It is similar to the 'any' character ., but you get
  1864. Xto choose which characters you want to match.  The character
  1865. Xclass is ended with the character ].  So, while a search for
  1866. X"ba.e" will match "bane", "bade", "bale", "bate", et cetera,
  1867. Xyou can limit it to matching "babe" and "bake" by searching
  1868. Xfor "ba[bk]e".  Only one of the characters inside the [ and ]
  1869. Xwill match a character.  If in fact you want to match any
  1870. Xcharacter except those in the character class, you can put
  1871. Xa ^ as the first character.  It must be the first character
  1872. Xof the class, or else it has no special meaning.  So, a
  1873. Xsearch for [^aeiou] will match any character except a vowel,
  1874. Xbut a search for [aeiou^] will match any vowel or a ^.
  1875. XIf you have a lot of characters in order that you want to
  1876. Xput in the character class, you may use a dash (-) as a
  1877. Xrange character.  So, [a-z] will match any letter (or any
  1878. Xlower case letter if EXACT mode is on), and [0-9a-f] will
  1879. Xmatch any digit or any letter 'a' through 'f', which happen
  1880. Xto be the characters for hexadecimal numbers.  If the dash is
  1881. Xat the beginning or end of a character class, it is taken to
  1882. Xbe just a dash.
  1883. X
  1884. X     The escape character \ is for those times when you want to be in
  1885. XMAGIC mode, but also want to use a regular expression character
  1886. Xto be just a character.  It turns off the special meaning of the
  1887. Xcharacter.  So a search for "it\." will search for a line with "it.",
  1888. Xand not "it" followed by any other character.  The escape character
  1889. Xwill also let you put ^, -, or ] inside a character class with no
  1890. Xspecial side effects.
  1891. X
  1892. END_OF_magic.doc
  1893. if test 3923 -ne `wc -c <magic.doc`; then
  1894.     echo shar: \"magic.doc\" unpacked with wrong size!
  1895. fi
  1896. # end of overwriting check
  1897. fi
  1898. echo shar: Extracting \"me110.rc\" \(1627 characters\)
  1899. if test -f me110.rc ; then 
  1900.   echo shar: Will not over-write existing file \"me110.rc\"
  1901. else
  1902. sed "s/^X//" >me110.rc <<'END_OF_me110.rc'
  1903. X;    EMACS.RC:    Startup file for MicroEMACS 3.8 (HP 110) 
  1904. X;
  1905. X;            This file is executed everytime the
  1906. X;            editor is entered
  1907. X
  1908. X;    ***** Rebind the Function key group
  1909. X
  1910. Xbind-to-key search-forward        FN;
  1911. Xbind-to-key search-reverse        FN<
  1912. Xbind-to-key next-window            FN=
  1913. Xbind-to-key execute-macro        FN>
  1914. Xbind-to-key find-file            FN?
  1915. Xbind-to-key view-file            FN@
  1916. Xbind-to-key save-file            FNA
  1917. Xbind-to-key exit-emacs            FNB
  1918. Xbind-to-key describe-key        FND
  1919. Xbind-to-key meta-prefix            `
  1920. Xbind-to-key beginning-of-file        FNs
  1921. Xbind-to-key end-of-file            FNt
  1922. X
  1923. X;    Enter Help
  1924. X1 store-macro
  1925. X    delete-other-windows
  1926. X    help
  1927. X    8 resize-window
  1928. X    bind-to-key execute-macro-12 FNH
  1929. X    bind-to-key execute-macro-13 FNP
  1930. X    bind-to-key execute-macro-11 FNT
  1931. X    beginning-of-file
  1932. X    2 forward-character
  1933. X    clear-message-line
  1934. X!endm
  1935. X
  1936. X;    consult file
  1937. X2 store-macro
  1938. X    2 split-current-window
  1939. X    previous-window
  1940. X    view-file @"File to Consult: "
  1941. X    8 resize-window
  1942. X    next-window
  1943. X!endm
  1944. X
  1945. X;    Exit Help
  1946. X11 store-macro
  1947. X    bind-to-key previous-line FNH
  1948. X    bind-to-key next-line FNP
  1949. X    bind-to-key execute-macro-1 FNT
  1950. X    delete-window
  1951. X    clear-message-line
  1952. X!endm
  1953. X
  1954. X;    last help page
  1955. X12 store-macro
  1956. X    beginning-of-line
  1957. X    search-reverse "=>"
  1958. X    1 redraw-display
  1959. X!endm
  1960. X
  1961. X;    next help page
  1962. X13 store-macro
  1963. X    beginning-of-line
  1964. X    2 forward-character
  1965. X    search-forward "=>"
  1966. X    1 redraw-display
  1967. X!endm
  1968. X
  1969. X;    bring up the function key window
  1970. X
  1971. X    2 split-current-window
  1972. X    select-buffer "Function Keys"
  1973. X    2 resize-window
  1974. X    insert-string " F1 search     | F2 search back | F3 next wind   | F4 Exec Macro  | MENU Help"
  1975. X    newline
  1976. X    insert-string "SYS desc key   | F5 Find file   | F6 view file   | F7 save file   | F8 exit"
  1977. X    beginning-of-file
  1978. X    unmark-buffer
  1979. X    next-window
  1980. END_OF_me110.rc
  1981. if test 1627 -ne `wc -c <me110.rc`; then
  1982.     echo shar: \"me110.rc\" unpacked with wrong size!
  1983. fi
  1984. # end of overwriting check
  1985. fi
  1986. echo shar: Extracting \"me150.rc\" \(1491 characters\)
  1987. if test -f me150.rc ; then 
  1988.   echo shar: Will not over-write existing file \"me150.rc\"
  1989. else
  1990. sed "s/^X//" >me150.rc <<'END_OF_me150.rc'
  1991. X;    EMACS.RC:    Startup file for MicroEMACS 3.4
  1992. X;
  1993. X;            This file is executed everytime the
  1994. X;            editor is entered
  1995. X
  1996. X;    ***** Rebind the Function key group
  1997. X
  1998. Xbind-to-key hunt-forward        FN^@
  1999. X1 label-function-key "hunt     forward"
  2000. Xbind-to-key hunt-backward        FN^A
  2001. X2 label-function-key "hunt    backward"
  2002. Xbind-to-key next-window            FN^B
  2003. X3 label-function-key "next      window"
  2004. Xbind-to-key execute-macro        FN^C
  2005. X4 label-function-key "exec       macro"
  2006. Xbind-to-key find-file            FN^D
  2007. X5 label-function-key "find       file"
  2008. Xbind-to-key view-file            FN^E
  2009. X6 label-function-key "view       file"
  2010. Xbind-to-key save-file            FN^F
  2011. X7 label-function-key "save       file"
  2012. Xbind-to-key exit-emacs            FN^G
  2013. X8 label-function-key "exit      emacs"
  2014. X
  2015. X;    Enter Help
  2016. X1 store-macro
  2017. X    help
  2018. X    8 resize-window
  2019. X    bind-to-key execute-macro-12 FNI
  2020. X    bind-to-key execute-macro-13 FNQ
  2021. X    bind-to-key execute-macro-11 FNT
  2022. X    add-mode "red"
  2023. X    begining-of-file
  2024. X    2 forward-character
  2025. X    clear-message-line
  2026. X!endm
  2027. X
  2028. X;    consult file
  2029. X2 store-macro
  2030. X    2 split-current-window
  2031. X    previous-window
  2032. X    view-file "@File to Consult: "
  2033. X    8 resize-window
  2034. X    add-mode "green"
  2035. X    add-mode "Black"
  2036. X    next-window
  2037. X!endm
  2038. X
  2039. X;    Exit Help
  2040. X11 store-macro
  2041. X    bind-to-key previous-page FNI
  2042. X    bind-to-key next-page FNQ
  2043. X    bind-to-key execute-macro-1 FNT
  2044. X    delete-window
  2045. X    clear-message-line
  2046. X!endm
  2047. X
  2048. X;    last help page
  2049. X12 store-macro
  2050. X    begining-of-line
  2051. X    search-reverse "=>"
  2052. X    1 redraw-display
  2053. X!endm
  2054. X
  2055. X;    next help page
  2056. X13 store-macro
  2057. X    begining-of-line
  2058. X    2 forward-character
  2059. X    search-forward "=>"
  2060. X    1 redraw-display
  2061. X!endm
  2062. X
  2063. X
  2064. END_OF_me150.rc
  2065. if test 1491 -ne `wc -c <me150.rc`; then
  2066.     echo shar: \"me150.rc\" unpacked with wrong size!
  2067. fi
  2068. # end of overwriting check
  2069. fi
  2070. echo shar: Extracting \"tcap.c\" \(3889 characters\)
  2071. if test -f tcap.c ; then 
  2072.   echo shar: Will not over-write existing file \"tcap.c\"
  2073. else
  2074. sed "s/^X//" >tcap.c <<'END_OF_tcap.c'
  2075. X/*    tcap:    Unix V5, V7 and BS4.2 Termcap video driver
  2076. X        for MicroEMACS
  2077. X*/
  2078. X
  2079. X#define    termdef    1            /* don't define "term" external */
  2080. X
  2081. X#include <stdio.h>
  2082. X#include    "estruct.h"
  2083. X#include        "edef.h"
  2084. X
  2085. X#if TERMCAP
  2086. X
  2087. X#define    MARGIN    8
  2088. X#define    SCRSIZ    64
  2089. X#define    NPAUSE    10            /* # times thru update to pause */
  2090. X#define BEL     0x07
  2091. X#define ESC     0x1B
  2092. X
  2093. Xextern int      ttopen();
  2094. Xextern int      ttgetc();
  2095. Xextern int      ttputc();
  2096. Xextern int    tgetnum();
  2097. Xextern int      ttflush();
  2098. Xextern int      ttclose();
  2099. Xextern int    tcapkopen();
  2100. Xextern int    tcapkclose();
  2101. Xextern int      tcapmove();
  2102. Xextern int      tcapeeol();
  2103. Xextern int      tcapeeop();
  2104. Xextern int      tcapbeep();
  2105. Xextern int    tcaprev();
  2106. Xextern int    tcapcres();
  2107. Xextern int      tcapopen();
  2108. Xextern int      tput();
  2109. Xextern char     *tgoto();
  2110. X#if    COLOR
  2111. Xextern    int    tcapfcol();
  2112. Xextern    int    tcapbcol();
  2113. X#endif
  2114. X
  2115. X#define TCAPSLEN 315
  2116. Xchar tcapbuf[TCAPSLEN];
  2117. Xchar *UP, PC, *CM, *CE, *CL, *SO, *SE;
  2118. X
  2119. XTERM term = {
  2120. X    NULL,    /* these four values are set dynamically at open time */
  2121. X    NULL,
  2122. X    NULL,
  2123. X    NULL,
  2124. X    MARGIN,
  2125. X    SCRSIZ,
  2126. X    NPAUSE,
  2127. X        tcapopen,
  2128. X        ttclose,
  2129. X        tcapkopen,
  2130. X        tcapkclose,
  2131. X        ttgetc,
  2132. X        ttputc,
  2133. X        ttflush,
  2134. X        tcapmove,
  2135. X        tcapeeol,
  2136. X        tcapeeop,
  2137. X        tcapbeep,
  2138. X        tcaprev,
  2139. X        tcapcres
  2140. X#if    COLOR
  2141. X    , tcapfcol,
  2142. X    tcapbcol
  2143. X#endif
  2144. X};
  2145. X
  2146. Xtcapopen()
  2147. X
  2148. X{
  2149. X        char *getenv();
  2150. X        char *t, *p, *tgetstr();
  2151. X        char tcbuf[1024];
  2152. X        char *tv_stype;
  2153. X        char err_str[72];
  2154. X
  2155. X        if ((tv_stype = getenv("TERM")) == NULL)
  2156. X        {
  2157. X                puts("Environment variable TERM not defined!");
  2158. X                exit(1);
  2159. X        }
  2160. X
  2161. X        if ((tgetent(tcbuf, tv_stype)) != 1)
  2162. X        {
  2163. X                sprintf(err_str, "Unknown terminal type %s!", tv_stype);
  2164. X                puts(err_str);
  2165. X                exit(1);
  2166. X        }
  2167. X
  2168. X       if ((term.t_nrow=(short)tgetnum("li")-1) == -1){
  2169. X               puts("termcap entry incomplete (lines)");
  2170. X               exit(1);
  2171. X       }
  2172. X    term.t_mrow =  term.t_nrow;
  2173. X
  2174. X       if ((term.t_ncol=(short)tgetnum("co")) == -1){
  2175. X               puts("Termcap entry incomplete (columns)");
  2176. X               exit(1);
  2177. X       }
  2178. X    term.t_mcol = term.t_ncol;
  2179. X
  2180. X        p = tcapbuf;
  2181. X        t = tgetstr("pc", &p);
  2182. X        if(t)
  2183. X                PC = *t;
  2184. X
  2185. X        CL = tgetstr("cl", &p);
  2186. X        CM = tgetstr("cm", &p);
  2187. X        CE = tgetstr("ce", &p);
  2188. X        UP = tgetstr("up", &p);
  2189. X    SE = tgetstr("se", &p);
  2190. X    SO = tgetstr("so", &p);
  2191. X    if (SO != NULL)
  2192. X        revexist = TRUE;
  2193. X
  2194. X        if(CL == NULL || CM == NULL || UP == NULL)
  2195. X        {
  2196. X                puts("Incomplete termcap entry\n");
  2197. X                exit(1);
  2198. X        }
  2199. X
  2200. X    if (CE == NULL)        /* will we be able to use clear to EOL? */
  2201. X        eolexist = FALSE;
  2202. X        
  2203. X        if (p >= &tcapbuf[TCAPSLEN])
  2204. X        {
  2205. X                puts("Terminal description too big!\n");
  2206. X                exit(1);
  2207. X        }
  2208. X        ttopen();
  2209. X}
  2210. X
  2211. Xtcapkopen()
  2212. X
  2213. X{
  2214. X    strcpy(sres, "NORMAL");
  2215. X}
  2216. X
  2217. Xtcapkclose()
  2218. X
  2219. X{
  2220. X}
  2221. X
  2222. Xtcapmove(row, col)
  2223. Xregister int row, col;
  2224. X{
  2225. X        putpad(tgoto(CM, col, row));
  2226. X}
  2227. X
  2228. Xtcapeeol()
  2229. X{
  2230. X        putpad(CE);
  2231. X}
  2232. X
  2233. Xtcapeeop()
  2234. X{
  2235. X        putpad(CL);
  2236. X}
  2237. X
  2238. Xtcaprev(state)        /* change reverse video status */
  2239. X
  2240. Xint state;        /* FALSE = normal video, TRUE = reverse video */
  2241. X
  2242. X{
  2243. X    static int revstate = FALSE;
  2244. X    if (state) {
  2245. X        if (SO != NULL)
  2246. X            putpad(SO);
  2247. X    } else
  2248. X        if (SE != NULL)
  2249. X            putpad(SE);
  2250. X}
  2251. X
  2252. Xtcapcres()    /* change screen resolution */
  2253. X
  2254. X{
  2255. X    return(TRUE);
  2256. X}
  2257. X
  2258. X#if    COLOR
  2259. Xtcapfcol()    /* no colors here, ignore this */
  2260. X{
  2261. X}
  2262. X
  2263. Xtcapbcol()    /* no colors here, ignore this */
  2264. X{
  2265. X}
  2266. X#endif
  2267. X
  2268. Xtcapbeep()
  2269. X{
  2270. X    ttputc(BEL);
  2271. X}
  2272. X
  2273. Xputpad(str)
  2274. Xchar    *str;
  2275. X{
  2276. X    tputs(str, 1, ttputc);
  2277. X}
  2278. X
  2279. Xputnpad(str, n)
  2280. Xchar    *str;
  2281. X{
  2282. X    tputs(str, n, ttputc);
  2283. X}
  2284. X
  2285. X
  2286. X#if    FLABEL
  2287. Xfnclabel(f, n)        /* label a function key */
  2288. X
  2289. Xint f,n;    /* default flag, numeric argument [unused] */
  2290. X
  2291. X{
  2292. X    /* on machines with no function keys...don't bother */
  2293. X    return(TRUE);
  2294. X}
  2295. X#endif
  2296. X#else
  2297. X
  2298. Xhello()
  2299. X{
  2300. X}
  2301. X
  2302. X#endif TERMCAP
  2303. END_OF_tcap.c
  2304. if test 3889 -ne `wc -c <tcap.c`; then
  2305.     echo shar: \"tcap.c\" unpacked with wrong size!
  2306. fi
  2307. # end of overwriting check
  2308. fi
  2309. echo shar: Extracting \"vt52.c\" \(3194 characters\)
  2310. if test -f vt52.c ; then 
  2311.   echo shar: Will not over-write existing file \"vt52.c\"
  2312. else
  2313. sed "s/^X//" >vt52.c <<'END_OF_vt52.c'
  2314. X/*
  2315. X * The routines in this file
  2316. X * provide support for VT52 style terminals
  2317. X * over a serial line. The serial I/O services are
  2318. X * provided by routines in "termio.c". It compiles
  2319. X * into nothing if not a VT52 style device. The
  2320. X * bell on the VT52 is terrible, so the "beep"
  2321. X * routine is conditionalized on defining BEL.
  2322. X */
  2323. X#define    termdef    1            /* don't define "term" external */
  2324. X
  2325. X#include        <stdio.h>
  2326. X#include        "estruct.h"
  2327. X#include    "edef.h"
  2328. X
  2329. X#if     VT52
  2330. X
  2331. X#define NROW    24                      /* Screen size.                 */
  2332. X#define NCOL    80                      /* Edit if you want to.         */
  2333. X#define    MARGIN    8            /* size of minimim margin and    */
  2334. X#define    SCRSIZ    64            /* scroll size for extended lines */
  2335. X#define    NPAUSE    100            /* # times thru update to pause */
  2336. X#define BIAS    0x20                    /* Origin 0 coordinate bias.    */
  2337. X#define ESC     0x1B                    /* ESC character.               */
  2338. X#define BEL     0x07                    /* ascii bell character         */
  2339. X
  2340. Xextern  int     ttopen();               /* Forward references.          */
  2341. Xextern  int     ttgetc();
  2342. Xextern  int     ttputc();
  2343. Xextern  int     ttflush();
  2344. Xextern  int     ttclose();
  2345. Xextern  int     vt52move();
  2346. Xextern  int     vt52eeol();
  2347. Xextern  int     vt52eeop();
  2348. Xextern  int     vt52beep();
  2349. Xextern  int     vt52open();
  2350. Xextern    int    vt52rev();
  2351. Xextern    int    vt52kopen();
  2352. Xextern    int    vt52kclose();
  2353. X
  2354. X#if    COLOR
  2355. Xextern    int    vt52fcol();
  2356. Xextern    int    vt52bcol();
  2357. X#endif
  2358. X
  2359. X/*
  2360. X * Dispatch table. All the
  2361. X * hard fields just point into the
  2362. X * terminal I/O code.
  2363. X */
  2364. XTERM    term    = {
  2365. X    NROW-1,
  2366. X        NROW-1,
  2367. X        NCOL,
  2368. X        NCOL,
  2369. X    MARGIN,
  2370. X    SCRSIZ,
  2371. X    NPAUSE,
  2372. X        &vt52open,
  2373. X        &ttclose,
  2374. X    &vt52kopen,
  2375. X    &vt52kclose,
  2376. X        &ttgetc,
  2377. X        &ttputc,
  2378. X        &ttflush,
  2379. X        &vt52move,
  2380. X        &vt52eeol,
  2381. X        &vt52eeop,
  2382. X        &vt52beep,
  2383. X        &vt52rev
  2384. X#if    COLOR
  2385. X    , &vt52fcol,
  2386. X    &vt52bcol
  2387. X#endif
  2388. X};
  2389. X
  2390. Xvt52move(row, col)
  2391. X{
  2392. X        ttputc(ESC);
  2393. X        ttputc('Y');
  2394. X        ttputc(row+BIAS);
  2395. X        ttputc(col+BIAS);
  2396. X}
  2397. X
  2398. Xvt52eeol()
  2399. X{
  2400. X        ttputc(ESC);
  2401. X        ttputc('K');
  2402. X}
  2403. X
  2404. Xvt52eeop()
  2405. X{
  2406. X        ttputc(ESC);
  2407. X        ttputc('J');
  2408. X}
  2409. X
  2410. Xvt52rev(status)    /* set the reverse video state */
  2411. X
  2412. Xint status;    /* TRUE = reverse video, FALSE = normal video */
  2413. X
  2414. X{
  2415. X    /* can't do this here, so we won't */
  2416. X}
  2417. X
  2418. X#if    COLOR
  2419. Xvt52fcol()    /* set the forground color [NOT IMPLIMENTED] */
  2420. X{
  2421. X}
  2422. X
  2423. Xvt52bcol()    /* set the background color [NOT IMPLIMENTED] */
  2424. X{
  2425. X}
  2426. X#endif
  2427. X
  2428. Xvt52beep()
  2429. X{
  2430. X#ifdef  BEL
  2431. X        ttputc(BEL);
  2432. X        ttflush();
  2433. X#endif
  2434. X}
  2435. X
  2436. Xvt52open()
  2437. X{
  2438. X#if     V7 | BSD
  2439. X        register char *cp;
  2440. X        char *getenv();
  2441. X
  2442. X        if ((cp = getenv("TERM")) == NULL) {
  2443. X                puts("Shell variable TERM not defined!");
  2444. X                exit(1);
  2445. X        }
  2446. X        if (strcmp(cp, "vt52") != 0 && strcmp(cp, "z19") != 0) {
  2447. X                puts("Terminal type not 'vt52'or 'z19' !");
  2448. X                exit(1);
  2449. X        }
  2450. X#endif
  2451. X        ttopen();
  2452. X}
  2453. X
  2454. Xvt52kopen()
  2455. X
  2456. X{
  2457. X}
  2458. X
  2459. Xvt52kclose()
  2460. X
  2461. X{
  2462. X}
  2463. X
  2464. X
  2465. X#if    FLABEL
  2466. Xfnclabel(f, n)        /* label a function key */
  2467. X
  2468. Xint f,n;    /* default flag, numeric argument [unused] */
  2469. X
  2470. X{
  2471. X    /* on machines with no function keys...don't bother */
  2472. X    return(TRUE);
  2473. X}
  2474. X#endif
  2475. X#else
  2476. X
  2477. Xvt52hello()
  2478. X
  2479. X{
  2480. X}
  2481. X
  2482. X#endif
  2483. END_OF_vt52.c
  2484. if test 3194 -ne `wc -c <vt52.c`; then
  2485.     echo shar: \"vt52.c\" unpacked with wrong size!
  2486. fi
  2487. # end of overwriting check
  2488. fi
  2489. echo shar: End of archive 1 \(of 14\).
  2490. cp /dev/null ark1isdone
  2491. MISSING=""
  2492. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
  2493.     if test ! -f ark${I}isdone ; then
  2494.     MISSING="${MISSING} ${I}"
  2495.     fi
  2496. done
  2497. if test "${MISSING}" = "" ; then
  2498.     echo You have unpacked all 14 archives.
  2499.     echo "See the readme file"
  2500.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2501. else
  2502.     echo You still need to unpack the following archives:
  2503.     echo "        " ${MISSING}
  2504. fi
  2505. ##  End of shell archive.
  2506. exit 0
  2507.